<style lang="scss" >
.remote-file-viewer {
  .vue-code-mirror__con {
    max-height: 50em;
    overflow: auto;
  }
}
</style>

<template>
<div class="remote-file-viewer">
  <vue-code-mirror v-if="js" :js="js"></vue-code-mirror>
</div>
</template>

<script>
import VueCodeMirror from "@example/components/VueCodeMirror";
export default {
  name: "RemoteFileViewer",
  components: {VueCodeMirror},
  props: {
    file: String
  },
  mounted() {
    this.load()
  },
  data() {
    return {
      res: {}
    }
  },
  computed: {
    js(){
      return this.res.body
    }
  },
  methods: {
    async load() {
      let f = await globalThis.Req.post('/api/demo1/file?v=' + ZY.rid() , {
        file: this.file
      })
      // console.log(f)
      this.res = f
    }
  }
}
</script>


